package bean;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;


@ManagedBean(eager=true)
@ApplicationScoped
public class Connexion {
    
	//commentaire test commit svn Mijoro  .
    private Connection connec;
    private static String login="postgres";
    private static String motdepasse="ingebook";
    private static String url="jdbc:postgresql://localhost:5432/ingebook";
    private Utilisateur unique;

    public Utilisateur getUnique() {
        return unique;
    }

    public Connexion(Connection connec) {
        this.connec = connec;
    }

    public void setUnique(Utilisateur unique) {
        this.unique = unique;
    }

    public Connexion() throws ClassNotFoundException, SQLException {
                Class.forName("org.postgresql.Driver");
                connec=DriverManager.getConnection(url,login,motdepasse);
		connec.getMetaData().allTablesAreSelectable();
    }

    public Connection getConnec() {
        return connec;
    }

    public void setConnec(Connection connec) {
        this.connec = connec;
    }

    public static String getLogin() {
        return login;
    }

    public static void setLogin(String login) {
        Connexion.login = login;
    }

    public static String getMotdepasse() {
        return motdepasse;
    }

    public static void setMotdepasse(String motdepasse) {
        Connexion.motdepasse = motdepasse;
    }

    public static String getUrl() {
        return url;
    }

    public static void setUrl(String url) {
        Connexion.url = url;
    }

    
}
